class CreepParser
{

	public static inline var r_sendgame = 100;
		// sendgame means "send today's game number" from the client,
		// and "send a specific game recording" from the server
	public static inline var r_getscores = 200;

	public static inline var r_test = -1;

	public function new()
	{
	}

	#if neko
	public function parse(requestcode : Int,
								 requestcontent : Dynamic)
	{
		var result : Dynamic = "";
		
		switch(requestcode)
		{
			case(r_test):
				result = "test";
			case(r_sendgame):
				if (requestcontent==null)
					result = Std.string(NetServer.getnum());
				else
				{
					trace("GETTING GAME");
					NetServer.updatedl(requestcontent);
					result = NetServer.getgame(requestcontent);
				}
			//case(r_getscores):
			//	result = new HighScore(requestcontent[0],
			//						   requestcontent[1],
			//						   requestcontent[2],
			//						   requestcontent[3]
			//							);				 
		}
		
		return haxe.Serializer.run(result);
		
	}
	#else flash9
	public function parse(requestcode : Int,
								 requestcontent : Dynamic)
	{
		var result : Dynamic = "";
		
		switch(requestcode)
		{
			case(r_test):
				result = "test";
			case(r_sendgame):
				result = requestcontent;
		}
		
		return haxe.Serializer.run(result);
		
	}	
	#end

}
